import tkinter as tk
from tkinter import messagebox


class DataWindow:
    def __init__(self, data_name, data_count):
        self.data_name = data_name
        self.data_count = data_count

    def show(self):
        window = tk.Toplevel()
        window.title("数据窗口")

        tk.Label(window, text=f"数据名称：{self.data_name}").pack()
        tk.Label(window, text=f"数据条数：{self.data_count}").pack()

        tk.Button(window, text="关闭", command=window.destroy).pack()


# 创建多个数据窗口
data_windows = [
    DataWindow("数据A", 10),
    DataWindow("数据B", 20),
    DataWindow("数据C", 30),
]

# 显示所有数据窗口
for window in data_windows:
    window.show()

# 启动主事件循环
tk.mainloop()